#include "stdio.h"
#include "stdint.h"
#include "string.h"
#include "DevicesQueue.h"
#include "FeedPhy.h"


int8_t cFeedPhyDatasSend(uint32_t uiChannel, void *pvDatas, int32_t iLength)
{
    QueueType *ptypeQueue;

    if((pvDatas == NULL) || (iLength < 1))
        return 1;

    switch (uiChannel)
    {
        case FEED_PHY_CHANNEL_UART0 : ptypeQueue = &g_TypeQueueUart0Send;   break;
        case FEED_PHY_CHANNEL_UART1 : ptypeQueue = &g_TypeQueueUart1Send;   break;
        case FEED_PHY_CHANNEL_BLE   : ptypeQueue = &g_TypeQueueBleSend;     break;
        case FEED_PHY_CHANNEL_MQTT  : ptypeQueue = &g_TypeQueueMqttSend;    break;
        case FEED_PHY_CHANNEL_TCP   : ptypeQueue = &g_TypeQueueUdpSend;     break;
        case FEED_PHY_CHANNEL_UDP   : ptypeQueue = &g_TypeQueueTcpSend;     break;

        default: return 2;
    }

    return enumQueuePushDatas(ptypeQueue, pvDatas, iLength);
}

int8_t cFeedPhyDatasAdd(void *pvDatas, int32_t iLength)
{
    return enumQueuePushDatas(&g_TypeQueueFeedSend, pvDatas, iLength);
}
